/**
 * Copyright 2015 jianglibo@gmail.com
 *
 */
package com.m3958.logcollector.service;

import javax.persistence.EntityManager;
import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.m3958.logcollector.domain.SeqOutOfJpa;

/**
 * @author jianglibo@gmail.com
 *         2015年12月28日
 *
 */
@Component
public class NextSeqNumber {
    
    @Autowired
    private EntityManager entityManager;
    
    
    @Transactional
    public Long getNextSeqId() {
        SeqOutOfJpa seq = new SeqOutOfJpa();
        entityManager.persist(seq);
        return seq.getId();
    }
}
